package com.itheima.controller;

import com.itheima.pojo.Result;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SessionController {
    @GetMapping("/s1")
    public Result session1(HttpSession session){
        session.setAttribute("name","zhangsan");
        return Result.success("ok");
    }
    @GetMapping("/s2")
    public Result session2(HttpSession session){
        Object name = session.getAttribute("name");
        return Result.success(name);
    }
}
